package tech.aistar.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tech.aistar.entity.Wrongtopic;

import java.util.List;

@Repository
public interface WrongtopicMapper {
    @Select("select * from wrongtopic")
    List<Wrongtopic> findAll();

    @Select("select * from wrongtopic where wrong_parperId = #{value}")
    List<Wrongtopic> findByParperId(Long id);

    @Insert("insert into wrongtopic(wrong_id,wrong_parperId,wrong_type,wrong_qid,wrong_uid,wrong_answer,test_id) value (#{wrongId},#{wrongParperId},#{wrongType},#{wrongQid},#{wrongUid},#{wrongAnswer},#{testId})")
    int insertWrongtopic(Wrongtopic wrongtopic);


    @Select("select * from wrongtopic where  test_id =  #{testId} and wrong_uid = #{usId}  ")
    List<Wrongtopic> findByTestId(@Param("testId") Long testId, @Param("usId") Long usId);



}
